import path from 'path'
import resolve from "@rollup/plugin-node-resolve"
import commonjs from '@rollup/plugin-commonjs'
import typescript from "rollup-plugin-typescript2"

export default {
    input: 'packages/vue/src/index.ts',
    output: [
        {
            format: 'iife',
            sourcemap: true,
            file: './packages/vue/dist/vue.js',
            name: 'Vue',
        },
    ],
    plugins: [
        typescript({
            tsconfig: path.resolve(__dirname, 'tsconfig.json'),
            // 排除测试文件
            exclude: ['**/__tests__/**', '**/*.test.ts']
        }),
        resolve(),
        commonjs(),
    ],
    // 添加外部依赖配置，排除测试相关文件
    external: (id) => {
        return id.includes('__tests__') || id.endsWith('.test.ts')
    }
}